#include<iostream>
using namespace std;
int main()
{
	int day,num,x1=0,x2=0,x3=0,i,j;
	cin>>day;
	for(j=1;j<=day;j++)
	{
		for(i=1;i<=3;i++)
		{
			cin>>num;
			if(i==1) x1+=num;
			else if(i==2) x2+=num; 
			else x3+=num;	
		}
	
	}
	cout<<x1<<" "<<x2<<" "<<x3<<" "<<x1+x2+x3<<endl;
	return 0;
}
